From: Sebastian Wick Date: Mon, 10 Feb 2025 16:00:48 +0000 (+0100) Subject: keyboard: Rely on tecla to figure out the current layout X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~153^2^2~50 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a7cc1e626a5a220c0179295066824948143e1224;p=gnome-shell.git keyboard: Rely on tecla to figure out the current layout Tecla shows the current layout, and keeps track of layout changes, if no arguments are passed to it. This is exactly the behavior we want for the "Show Keyboard Layout" button. Part-of: --- diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index a09af32b1..1b43e1051 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -1104,35 +1104,6 @@ class InputSourceIndicator extends PanelMenu.Button { _showLayout() { Main.overview.hide(); - let source = this._inputSourceManager.currentSource; - let xkbLayout = ''; - let xkbVariant = ''; - - if (source.type === INPUT_SOURCE_TYPE_XKB) { - [, , , xkbLayout, xkbVariant] = KeyboardManager.getXkbInfo().get_layout_info(source.id); - } else if (source.type === INPUT_SOURCE_TYPE_IBUS) { - let engineDesc = IBusManager.getIBusManager().getEngineDesc(source.id); - if (engineDesc) { - xkbLayout = engineDesc.get_layout(); - xkbVariant = engineDesc.get_layout_variant(); - } - - // The `default` layout from ibus engine means to - // use the current keyboard layout. - if (xkbLayout === 'default') { - const current = this._inputSourceManager.keyboardManager.currentLayout; - xkbLayout = current.layout; - xkbVariant = current.variant; - } - } - - if (!xkbLayout || xkbLayout.length === 0) - return; - - let description = xkbLayout; - if (xkbVariant.length > 0) - description = `${description}+${xkbVariant}`; - - Util.spawn(['tecla', description]); + Util.spawn(['tecla']); } });